class Person{
  private name: string;
  protected age: number;
  public gender: string;

  constructor(name: string, age: number, gender: string){
    this.name = name;
    this.age = age;
    this.gender = gender;
  }

}

class Student extends Person{

  getInfo(){
    // return this.name
    return this.age
  }
}

let s = new Student('张三', 2, '女')

// s.age

console.log(s.gender)



class BankAccount{
  private money: number;

  constructor(money: number){
    this.money = money
  }

  getMoney(){
    return this.money
  }

  deposit(money: number){
    if(money > 0){
      this.money += money
    }else{
      console.log('存钱为负数!!!')
    }
  }

  withdrawal(money: number){
    if(money >0){
      if(money > this.money){
        console.log('余额不足')
      }else{
        this.money -= money
      }
    }else{
      console.log('取钱为负数!!!')
    }
  }
}

let m = new BankAccount(100)

console.log(m.getMoney())

// m.deposit(-100)
m.deposit(50)

m.withdrawal(200)

